<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <input type="text" id="text" />
  </head>
  <body>
    <script>
      var text = document.getElementById("text");
      // var re = /(\([a-zA-Z0-9])*([a-zA-Z0-9])\2{2}([a-zA-Z0-9])*/g;
      var re = /([0-9a-zA-Z\s_!@#$%^&*()><,.-=_+/?|.])\1{2}/;
      var re2 = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()><,.-=_+/?|.\s]){8,}/;
      let re3 = /(?![a-zA-Z]+$)(?![a-z0-9]+$)(?![A-Z0-9]+$)(?![0-9!@]+$)(?![a-z!@]+$)(?![A-Z!@]+$)[a-zA-Z0-9!@]{8,16}/; //大小写数字字符四种中的三种
      var date = /^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/;
      text.onchange = (e) => {
        console.log(re3.test(e.target.value), "密码三种");
        console.log(!re.test(e.target.value), "密码重复");
        if (re2.test(e.target.value) && !re.test(e.target.value)) {
          console.log(1);
        } else {
          console.log(2);
        }

        // console.log(e.target.value.match(re));
      };
    </script>
  </body>
</html>
